<template>
  <e-table
    ref="eTable"
    :tableData="tableData"
    :columns="columns"
    :loading="loading"
    :pageObj="null"
    :total="total"
  >
    <el-table-column slot="evalItemName" label="项目名称" align="center" width="120">
      <template slot-scope="scope">
        <el-button type="text" @click="handleQuery(scope.row)">{{ scope.row.evalItemName }}</el-button>
      </template>
    </el-table-column>
    <el-table-column slot="upAndLimit" label="奖惩上-下限" align="center" width="120">
      <template slot-scope="scope">{{ scope.row.rewardUpLimit + '-' + scope.row.rewardLowLimit}}</template>
    </el-table-column>
  </e-table>
</template>

<script>
import { queryHistory } from '@/api/eval'

export default {
  data() {
    return {
      queryParam: {
        pageNo: 1,
        pageSize: 10
      },
      loading: false,
      // 表头
      columns: [
        { slot: 'evalItemName' },
        {
          label: '考评标准',
          prop: 'rewardStandard'
        },
        { slot: 'upAndLimit' },
        {
          label: '考评项目得分',
          prop: 'itemScore'
        },
        {
          label: '奖惩总金额',
          prop: 'itemMoney'
        }
      ],
      tableData: [],
      total: 1
    }
  },
  methods: {
    show(arr) {
      this.tableData = arr
    },
    async handleQuery(row) {
      console.log('row', row)
      const res = await queryHistory({ evalItemId: row.evalItemId })
      console.log('res', res)
      this.$emit('postData', res.data)
    },
    handleEdit(bool, row) {
      this.$emit('edit', bool, row)
    }
  }
}
</script>